//@ts-nocheck
const format = {
    //时间戳13位
    formatDate: function (time) {//时间戳转日期
        let date = new Date(Number(time));
        let y = date.getFullYear();
        let MM = date.getMonth() + 1;
        MM = MM < 10 ? ('0' + MM) : MM;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        let m = date.getMinutes();
        m = m < 10 ? ('0' + m) : m;
        let s = date.getSeconds();
        s = s < 10 ? ('0' + s) : s;
        return y + '-' + MM + '-' + d + ' ' + h + ':' + m;
        // return y + '-' + MM + '-' + d;
    },
    //
    formatDate2: function (time) {//时间戳转日期
        let date = new Date(Number(time));
        let y = date.getFullYear();
        let MM = date.getMonth() + 1;
        // MM = MM < 10 ? ('0' + MM) : MM;
        let d = date.getDate();
        // d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        // h = h < 10 ? ('0' + h) : h;
        let m = date.getMinutes();
        // m = m < 10 ? ('0' + m) : m;
        let s = date.getSeconds();
        // s = s < 10 ? ('0' + s) : s;
        return {
            y: Number(y),
            m: Number(MM),
            d: Number(d)
        };
        // return y + '-' + MM + '-' + d;
    },
}
module.exports = format